package autoupdate.test;

import java.awt.BorderLayout;
import java.awt.Container;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JProgressBar;

import common.test.Module;

public class DLoadFrameBuilder implements Runnable{
	private Module staleModule;

	public DLoadFrameBuilder(Module staleModule){
		super();
		this.staleModule = staleModule;
	}

	public void run() {
    	
    	JFrame theFrame = new JFrame("Progress Bar");
        theFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JProgressBar aJProgressBar = new JProgressBar();
        aJProgressBar.setValue(0);
        JLabel jLabel1 = new JLabel("0 KB/s");
        JLabel jLabel2 = new JLabel("0 KB/s");
        
        Container contentPane = theFrame.getContentPane();
        contentPane.add(aJProgressBar, BorderLayout.SOUTH);
        contentPane.add(jLabel1, BorderLayout.WEST);
        contentPane.add(jLabel2, BorderLayout.EAST);
        
    	theFrame.setSize(300, 200);
        theFrame.setVisible(true);
        
        InputStreamWorker isw = new InputStreamWorker(theFrame, aJProgressBar, jLabel1, jLabel2, staleModule);
        isw.execute();
    }

}
